#!/usr/bin/env node

const fs = require('fs');
const file = process.argv[2] || __filename;

const rs = fs.createReadStream(file);

if(!fs.existsSync(file)) {
    console.error('%s not exist!', file);
    process.exit(1);
}
  
if(!fs.statSync(file).isFile()) {
    console.error('%s is not file!', file);
    process.exit(2);
}

rs.on('error', (e)=>{
  console.error(e.message)
})
rs.pipe(process.stdout);
